<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>注册会员</title>
    <script src="/static/mobile/js/mui.min.js"></script>
    <link href="/static/mobile/css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="/static/mobile/css/basic.css"/>
    <link rel="stylesheet" type="text/css" href="/static/mobile/css/resiter_daili.css"/>
    <script type="text/javascript" src="/static/mobile/js/jquery.js"></script>
	<link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <script type="text/javascript" charset="utf-8">
      	mui.init();
    </script>
	<style>
		.section2 .sub button {
			width: 100%;
			padding: 5px;
			font-size: 1rem;
			color: #fff;
			background: #E52D2D;
			border-color: #E52D2D;
		}
		.xu_btn1{
			width: 48% !important;
			margin-right: 80px !important;
		}
		.xu_btn{
			position: absolute !important;
			right:15px;
			top:15px;
			color: #E52D2D !important;
			height: 20px;
			line-height:20px;
			text-align: center !important;
			width: 80px !important;
		}
		.slide_btn {
			float: right;
			width: 80%;
		}
		.slide_btn>div{
			float: left;
			width: 33.3%;
			text-align: center;
		}
		.slide_btn>div select{
			width: 100%;
		}
		.slide_btn>div>div>div input{
			width: 100%;
			float: inherit;
			text-align: center;
		}
	</style>
</head>
<body>
	<div class="sectionx">
		<header class="mui-bar mui-bar-nav" >
			<a class="mui-icon mui-icon-left-nav mui-pull-left" href="javascript:history.back(-1)" style="color: #4E4E4E;"></a>
			<h1 class="mui-title">注册会员</h1>
		</header>
	</div>
	<div class="section2">
		<div class="layui-form">
			<div class="admin-main layui-anim layui-anim-upbit" ng-app="hd" ng-controller="ctrl">
		<form  method="post">
			<ul>

				<li class=" mui-clearfix">
					<span>会员编号</span>
					
					<input type="text" name='nickname' placeholder="请填写会员编号" value="{$bianhao}"/>
					<span class="xing">*</span>
					
				</li>
				<li class=" mui-clearfix">
					<span>会员手机号</span>

					<input type="text" name='mobile' id="mobile" placeholder="请填写会员手机号"/>
					<span class="xing">*</span>

				</li>
				{if $sys.code=='open'}
				<li class=" mui-clearfix">
					<span>短信验证码</span>
					<input type="text" name='code' placeholder="请填写短信验证码" class="xu_btn1">
					<input type="button" id="btn" value="获取验证码" onclick="settime(this)" class="xu_btn"/>
					<span class="xing">*</span>
				</li>
				{/if}
	<!--			<li class=" mui-clearfix">
					<span>会员姓名</span>

					<input type="text" placeholder="请填写会员姓名" name='username'/>
					<span class="xing">*</span>
				</li>
				<li class=" mui-clearfix">
					<span>会员身份证</span>
					<input type="text" placeholder="请填写会员身份证" name='shenfenzheng'/>
					<span class="xing">*</span>
				</li>-->
				<li class=" mui-clearfix" >
					<span>会员密码</span>
					<input type="password" placeholder="请填写会员密码" name='password' value="{$sys.pwd1}"/>
					<span class="xing">*</span>
					
				</li>
				<li class=" mui-clearfix" >
					<span>二级密码</span>
					<input type="password" placeholder="请填写二级密码" name='twopassword' value="{$sys.pwd2}"/>
					<span class="xing">*</span>

				</li>
		<!--		<li class=" mui-clearfix" >
					<span>开户银行</span>
					<input type="text" placeholder="请填写开户银行" name='bank_name'/>
					<span class="xing">*</span>

				</li>
				<li class=" mui-clearfix" >
					<span>开户卡号</span>
					<input type="text" placeholder="请填写开户卡号" name='bank_card'/>
					<span class="xing">*</span>

				</li>
				<li class=" mui-clearfix" >
					<span>开户地址</span>
					<input type="text" placeholder="请填写开户地址" name='bank_dizhi'/>
					<span class="xing">*</span>

				</li>-->
		<!--		<li class=" mui-clearfix">
					<span>收货地址</span>
					<div class="slide_btn">
						<div class="layui-input-inline">
							<select name="province" ng-model="field.province" lay-filter="province" ng-options="v.id as v.name for v in province" ng-selected="v.id==field.province">
								<option value="">请选择省</option>
							</select>
						</div>
						<div class="layui-input-inline" >
							<select name="city" id="city" ng-model="field.city" lay-filter="city" ng-options="v.id as v.name for v in city" ng-selected="v.id==field.city">
								<option value="">请选择市</option>
							</select>
						</div>
						<div class="layui-input-inline">
							<select name="district" id="district" ng-model="field.district" lay-filter="district" ng-options="v.id as v.name for v in district" ng-selected="v.id==field.district">
								<option value="">请选择县/区</option>
							</select>
						</div>
					</div>
				</li>
				<li class="lix mui-clearfix">
					<span>详情地址</span>
					<input type="text" placeholder="请输入详情地址" name='dizhi' value='{$user.dizhi}'/>
					<span class="xing">*</span>
				</li>-->
				<li class=" mui-clearfix">
					<span>推荐人编号</span>
					<input type="text" placeholder="请填写推荐人编号" name='topmobi' value="{$user.nickname}"/>
					<span class="xing">*</span>
				</li>
	<!--			<li class=" mui-clearfix">
					<span>服务中心编号</span>
					<input type="text" placeholder="请填写服务中心编号" name='center_id'/>
					<span class="xing">*</span>
				</li>-->
				{if $sys.anzhi=='open'}
				<li class=" mui-clearfix">
					<span>安置人编号</span>
					<input type="text" placeholder="请填写安置人编号" name='fathername' value="{$user.nickname}"/>
					<span class="xing">*</span>
				</li>

				<li class="mui-clearfix">
					<span>安置区域</span>
					<select name="treeplace">
						<option value="1">A区</option>
						<option value="2">B区</option>
					</select>
				</li>
				{/if}
		<!--		<li class="mui-clearfix">
					<span>报单级别</span>
					<select name="level">
						{volist name='levels' id='vl'}
						<option value="{$vl.level}">{$vl.level_name}</option>

						{/volist}
					</select>
				</li>-->
				
				
			</ul>
			<div class="ge"></div>
			<div class="sub">
				<button type="button" class="layui-btn" lay-filter="sub" lay-submit>确定注册</button>
			</div>
		</form>
			</div>
		</div>
	</div>
	
	
</body>
<script type="text/javascript" >
    mui('body').on( 'tap' , 'a' , function(){
        document.location.href=this.href;
    })
</script>
<script src="/static/plugins/layui/layui.js"></script>
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form,$ = layui.jquery;
        // 登录提交监听
        form.on('submit(sub)', function (data) {
            var loading = layer.load(1, {shade: [0.1, '#fff']});
            $.post("{:url('daili')}",data.field,function(res){
                layer.close(loading);
                if(res.code > 0){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        location.href = "{:url('daili')}";
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2});
                    $('.captcha img').attr('src','{:url("verify")}?id='+Math.random());
                }
            });
        })
    })
</script>
<script type="text/javascript">
	var countdown = 60;
	function settime(obj) {
		obj.setAttribute("disabled", true);
		/*ajax发短信
		 */
		var mobile=$('#mobile').val();
		if(mobile==''){
			layer.msg("请输入手机号码",{time:1000,icon:2});
			obj.removeAttribute("disabled");
			return false;
		}
		$.ajax({
			type : "POST",  //请求方式
			async:false,
			url : "{:url('duanxin')}",  //请求路径
			dataType:"html",
			data :'mobile='+mobile,
			success : function(msg) {  //异步请求成功执行的回调函数
				var jsonParseJson=JSON.parse(msg);
				if(jsonParseJson['success']==1){
					/*				layer.msg(jsonParseJson['msg'],{time:1000,icon:1},function(){
					 location.href = "{:url('jihuo')}";
					 });*/
					layer.msg(jsonParseJson['msg'],{time:1000,icon:1});
				}else{
					layer.msg(jsonParseJson['msg'],{time:1000,icon:2});
				}

			}
		});
		var id=setInterval(function() {
			if(countdown==0){
				obj.removeAttribute("disabled");
				obj.value="获取验证码";
				clearInterval(id);
			}else{
				obj.value="重新发送(" + countdown + ")";
				countdown--;
			}
		},1000);
	}

</script>
<script src="/static/common/js/angular.min.js"></script>
<script>
    var m = angular.module('hd',[]);
    m.controller('ctrl',function($scope) {
        $scope.field = {$inf|raw};
        $scope.province = {$province|raw};
        $scope.city = {$city|raw};
        $scope.district = {$district|raw};
        layui.use(['form', 'layer'], function () {
            var form = layui.form, layer = layui.layer,$= layui.jquery;
            form.on('select(province)', function(data) {
                var pid = data.value;
                var loading = layer.load(1, {shade: [0.1, '#fff']});
                $.get("{:url('getRegion')}?pid=" + pid, function (data) {
                    layer.close(loading);
                    var html='<option value="">请选择市</option>';
                    $.each(data, function (i, value) {
                        html += '<option value="number:'+value.id+'">'+value.name+'</option>';
                    });
                    $('#city').html(html);
                    $('#district').html('<option value="">请选择县/区</option>');
                    form.render()
                });
            });
            form.on('select(city)', function(data) {
                var pid = data.value;
                var loading = layer.load(1, {shade: [0.1, '#fff']});
                $.get("{:url('getRegion')}?pid=" + pid, function (data) {
                    layer.close(loading);
                    var html='<option value="">请选择县/区</option>';
                    $.each(data, function (i, value) {
                        html += '<option value="number:'+value.id+'">'+value.name+'</option>';
                    });
                    $('#district').html(html);

                    form.render()
                });
            });
            form.on('submit(submit)', function (data) {
                // 提交到方法 默认为本身
                var loading = layer.load(1, {shade: [0.1, '#fff']});
                data.field.id = $scope.field.id;
                $.post("", data.field, function (res) {
                    layer.close(loading);
                    if (res.code > 0) {
                        layer.msg(res.msg, {time: 1800, icon: 1}, function () {
                            location.href = res.url;
                        });
                    } else {
                        layer.msg(res.msg, {time: 1800, icon: 2});
                    }
                });
            })
        });
    });
</script>
</html>